[20251122] BOJ / G5 / 김밥천국의 계단 / 이종환 #1479
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/28069
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
천국 문 앞에는 무한히 많은 계단이 있고 가장 아래 계단의 번호가 0번이며, 위로 올라가면서 순서대로 번호가 붙어있습니다. 그중
$N$ 번째 계단 옆에 김밥 가게가 있습니다.
민희는 매번 다음의 2가지 행동 중 하나를 선택해서 총
$K$ 번 행동할 수 있으며, 정확히
$K$ 번째 행동에서
$N$ 번째 계단에 도달하면 미니김밥을 먹을 수 있습니다.
계단 한 칸을 올라갑니다.
$i$ 번째 계단에서 지팡이를 두드리면
민희가 집에서 가지고 온 지팡이를 계단에 두드립니다. 만약 민희가
현재 민희는 0번째 계단에 있습니다. 민희가 미니김밥을 먹을 수 있을지 구해 봅시다.
🔍 풀이 방법
dp를 통해 너무나 간단히 풀수 있다.
참고로 0칸에서 점프하면 그대로 0칸이기에, 움직임횟수를 움직임없이 소모시킬수 있다.
그렇기에 k번 이하로 도달할 수 있으면 가능하다고 판단하면된다.
⏳ 회고